<?php
	require("function.php");
	//创建连接
	$con = getconnect('china');
	$username = $_POST['username'];
	$password =md5($_POST['password']); // $_POST['password']; //
	echo "the username is :".$username;
	echo "the password is :".$password;
	
	//从数据库读取数据判断用户数据是否正确
	$sql4 = "SELECT * FROM users where username='$username' and password='$password' and state=1;";
	$result = mysqli_query($con,$sql4);
	if(mysqli_num_rows($result)==1)
	{	
		$row=mysqli_fetch_array($result);
		$_SESSION['user']=$username;
		skip("登录成功","../index.html");
	}
	else {
	     	skip("用户名或密码错误","../login.html");
		}
	mysqli_close($con);
?>


